#ifndef _LockGuard_HPP_
#define _LockGuard_HPP_

#include "Mutex.hpp"
#include <iostream>

namespace tp{

class LockGuard{
public:
    LockGuard(Mutex & mutex)
    :_mutx(mutex){
        _mutx.lock();
    }

    ~LockGuard(){
        _mutx.unlock();
    }
private:
    Mutex & _mutx;
};



}
#endif


#if 0
int main(){
    tp::Mutex mutex;
    tp::LockGuard lockguard(mutex);
    std::cout << "after lock" << std::endl;
}
#endif
